package com.softer.wxzj.controller;


import com.github.pagehelper.PageInfo;
import com.softer.wxzj.common.entity.CommonResult;
import com.softer.wxzj.common.entity.Page;
import com.softer.wxzj.common.util.ShiroUser;
import com.softer.wxzj.entity.SysRole;
import com.softer.wxzj.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * RoleController class
 * @author zcz
 * @date 2019/1/16
 */
@RestController
@RequestMapping("/role")
@Slf4j
public class RoleController {
    @Autowired
    RoleService roleService;

    @RequestMapping("/add")
    public CommonResult add(SysRole role) {
        role.setCreater(ShiroUser.getUserName());
        return roleService.insert(role);
    }
    @RequestMapping("/update")
    public CommonResult update(SysRole role) {
        return roleService.update(role);
    }
    @RequestMapping("/delete")
    public CommonResult delete(String id) {
        return roleService.delete(id);
    }
    @RequestMapping("/getList")
    public PageInfo<SysRole> getRoleList(Page page, SysRole role) {
        return roleService.getRoleList(page,role);
    }


}
